﻿@using System.Data
@using ZoomLa.Common
@using ZoomLa.SQLDAL
@model ZoomLa.SQLDAL.SQL.PageSetting
@{
    Model.cols = 10;
    Model.url = "MyAskList";
}
@functions{
    protected string GetStatus(int id)
    {
        if (id == 0)
        {
            return "未处理";
        }
        else if (id == 1)
        {
            return "处理中";
        }
        else
        {
            return "<font class='red'>已解决</font>";
        }
    }
    public string GetLeftString(string str, int length)
    {
        //str = function.Decode(str);
        if (str.Length <= length)
            return str;
        return str.Substring(0, length) + "..."; ;
    }
    protected string Getname(string isNi, string UserName, string UserID)
    {
        string str = "";
        if (isNi == "1") { str = "匿名"; }
        else { str = " <a href='/ShowList.aspx?id=" + UserID + "' target='_blank'>" + UserName + "</a></asp:Label>"; }
        return str;
    }
    public string gettype(string id)
    {
        int gid = Convert.ToInt32(id);
        DataTable dt = Sql.Sel("zl_grade", " GradeID=" + gid, "");
        if (dt.Rows.Count > 0)
        {
            string name;
            name = (dt.Rows[0]["GradeName"]).ToString();
            return name;
        }
        else
            return "";
    }
}
<div id="EGV">
    <table class="table table-striped table-bordered table-hover">
        @if (Model.itemCount > 0)
        {
            <tr><td></td></tr>
            foreach (DataRow dr in Model.dt.Rows)
            {
                <tr>
                    <td>
                        <div class="qst">
                            <div class="btn btn-success btn-xs">@MvcHtmlString.Create(GetStatus(Convert.ToInt32(dr["Status"])))</div>
                            <h3>
                                <a target="_self" href="Interactive?ID=@dr["ID"]">@GetLeftString(dr["Qcontent"].ToString(), 30)</a>
                            </h3>
                            <div class="fs">
                                @MvcHtmlString.Create(Getname(dr["isNi"] as string, dr["UserName"] as string, @dr["UserID"] as string))  - @DataConverter.CDate(dr["AddTime"]).ToString("yyyy-MM-dd") - <a href="Classification?GradeID=@dr["QueType"]">@gettype(dr["QueType"] as string)</a>
                            </div>
                        </div>
                    </td>
                </tr>
            }
            @Html.Partial("_page", Model)
        }
        else
        {
            <tr><td>当前没有信息</td></tr>
        }
    </table>
</div>